#include<stdio.h>
#include<math.h>
int main()
{
    int n;
    scanf("%d\n",&n);
    int N , i;
    while(n--){
        scanf("\n%d",&N);
        if(N == 1){
            printf("No\n");
            continue;
        }
        if(N <= 3){
            printf("Yes\n");
            continue;
        }
        if(N % 6 != 1 && N % 6 !=5){
            printf("No\n");
            continue;
        }
        for(i = 5;i <= sqrt(N);i += 6){
            if(N % i == 0 || N % (i+2) == 0){
                printf("No\n");
                break;
            }
        }
        printf("Yes\n");
    }
    return 0;
}
